home *** CD-ROM | disk | FTP | other *** search
- #include "ToolSort.h"
- /*=========================================================================
- Module: DisplayError
-
- Purpose: Display the error messages associated with err.
-
- returns:
-
- Functional Details:
-
- If alert resources are not available just beep and exit.
- else display error messages.
-
- =========================================================================*/
-
- DisplayError(err)
- unsigned int err;
- {
- int i; /* index counter */
- int index[9]; /* index to diagnostics */
- int s; /* shift counter */
- Handle h1, h2;
- long maxmem;
- long grow;
-
- static char *diag[9];
-
- diag[0] = ""; /*No_Error*/
- diag[1] = "\pSelection must end with a carriage return."; /*End_Error*/
- diag[2] = "\pNo selection of type 'TEXT' in scarp."; /*Type_Error*/
- diag[3] = "\pNot enough memory."; /*Memory_Error*/
- diag[4] = "\pNil Handle Error."; /*Nil_Hand_Error*/
- diag[5] = "\pNo selection, scrap empty."; /*Empty_Error*/
- diag[6] = "\pA system error, probably relating to the filing system."; /*Sys_Error*/
- diag[7] = "\pError writing desk scrap."; /*Scrap_Error*/
- diag[8] = "\pError writing writing TEScrap."; /*TEScrap_Error*/
-
- h1 = GetResource('ALRT', alertID); /* Check for resource load error */
- h2 = GetResource('DITL', alertID);
- if ( h1!=NIL && h2!=NIL )
- {
- for (s=0, i=0; s<9; s++)
- {
- index[s] = 0; /* initialize index arry to zero */
- if ( 0x0001 & err )
- {
- index[i] = s+1; /* set index array to index of diagnostics */
- i++;
- }
- err >>= 1; /* shift err 1 bit to the right */
- }
- InitCursor();
- ParamText(diag[index[0]],diag[index[1]],
- diag[index[2]],diag[index[3]]);
- StopAlert( alertID, NIL );
- }
- else
- {
- if ( h1 != NIL )
- ReleaseResource( h1 );
- if ( h2 != NIL )
- ReleaseResource( h2 );
-
- maxmem = MaxMem(&grow);
- if ( maxmem > 500L )
- SysBeep( 4 ); /* SysBeep needs memory to work with */
- }
- }
-